<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>代理管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <style>
        thead tr th{text-align: center!important;font-weight: bold!important;}
        tr td{text-align: center!important;}
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body layui-form">
                    <%-- 查询条件设置 --%>
                    <div class="layui-container layui-form-item" style="padding-bottom: 50px">
                        <div class="layui-col-md12">
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3" style="line-height: 38px">明细时间：</div>
                                <div class="layui-col-sm7">
                                    <input class="layui-input" name="queryTime" id="laydate-cn" autocomplete="off">
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3" style="line-height: 38px">流水号：</div>
                                <div class="layui-col-sm7">
                                    <input type="text" name="payCode" class="layui-input" value="${details.payCode}">
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3" style="line-height: 38px">操作类型：</div>
                                <div class="layui-col-sm7">
                                    <select name="typeId" class="select">
                                        <option value="">全部</option>
                                        <c:forEach items="${handleList}" var="h">
                                            <option value="${h.id}" <c:if test="${details.typeId==h.id}">selected</c:if>>${h.name}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3">
                                    <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">查询</button>
                                </div>
                            </div>
                        </div>
                    </div>

                    <table class="layui-table" lay-filter="profit-table" id="profit-table"></table>
                    <script type="text/html" id="isout">
                        {{# if(d.isout == 1){ }}
                        	收入
                        {{# } else { }}
                       		支出
                        {{# } }}
                    </script>
                    <script type="text/html" id="index">
                        {{d.LAY_TABLE_INDEX+1}}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form','table','laydate'], function(){
        var form = layui.form,table = layui.table,$ = layui.$,admin=layui.admin,laydate=layui.laydate;
        laydate.render({
            elem: '#laydate-cn',
            range:'~'
        });

        table.render({
            elem:'#profit-table',
            url:'/data/queryProfit',
            page:true,
            request:{
                pageName:'current',
                limitName:'size'
            },
            cols:[[
                {field:'index',title:'序号',width:80,templet:"#index"},
                {field:'payCode',title:'流水号',width:180},
                {field:'isout',title:'收支',width:180,templet:"#isout"},
                {field:'typeName',title:'操作类型',minWidth:100},
                {field:'original',title:'原始值',minWidth:100},
                {field:'cost',title:'操作值',minWidth:100},
                {field:'last',title:'最终值',minWidth:100},
                {field:'createTime',title:'时间',minWidth:170,templet:"<div>{{layui.util.toDateString(d.createTime,'yyyy-MM-dd HH:mm:ss')}}</div>"},
                {field:'targetName',title:'来源方',minWidth:170},
                {field:'remark',title:'备注',minWidth:70},
                {field : 'createTime', title : '创建时间', minWidth:150,
                    templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm')}}</div>"
                }
            ]]
        });

        //监听搜索
        form.on('submit(LAY-app-contlist-search)', function(data){
            var field = data.field;
            //执行重载
            table.reload('profit-table', {
                where: field
            });
        });

    });
</script>
</body>
</html>